<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "artistainfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "obrasgridcls.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$artista_add = NULL; // Initialize page object first

class cartista_add extends cartista {

	// Page ID
	var $PageID = 'add';

	// Project ID
	var $ProjectID = "{04BABB11-908C-4D25-BABD-9F78C0B5CBAE}";

	// Table name
	var $TableName = 'artista';

	// Page object name
	var $PageObjName = 'artista_add';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (artista)
		if (!isset($GLOBALS["artista"]) || get_class($GLOBALS["artista"]) == "cartista") {
			$GLOBALS["artista"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["artista"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'add', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'artista', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->ProjectID . $this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanAdd()) {
			$Security->SaveLastUrl();
			$this->setFailureMessage($Language->Phrase("NoPermission")); // Set no permission
			$this->Page_Terminate("artistalist.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter = "";
	var $DbDetailFilter = "";
	var $Priv = 0;
	var $OldRecordset;
	var $CopyRecord;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Process form if post back
		if (@$_POST["a_add"] <> "") {
			$this->CurrentAction = $_POST["a_add"]; // Get form action
			$this->CopyRecord = $this->LoadOldRecord(); // Load old recordset
			$this->LoadFormValues(); // Load form values
		} else { // Not post back

			// Load key values from QueryString
			$this->CopyRecord = TRUE;
			if (@$_GET["ArtistaId"] != "") {
				$this->ArtistaId->setQueryStringValue($_GET["ArtistaId"]);
				$this->setKey("ArtistaId", $this->ArtistaId->CurrentValue); // Set up key
			} else {
				$this->setKey("ArtistaId", ""); // Clear key
				$this->CopyRecord = FALSE;
			}
			if ($this->CopyRecord) {
				$this->CurrentAction = "C"; // Copy record
			} else {
				$this->CurrentAction = "I"; // Display blank record
				$this->LoadDefaultValues(); // Load default values
			}
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Set up detail parameters
		$this->SetUpDetailParms();

		// Validate form if post back
		if (@$_POST["a_add"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = "I"; // Form error, reset action
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues(); // Restore form values
				$this->setFailureMessage($gsFormError);
			}
		}

		// Perform action based on action code
		switch ($this->CurrentAction) {
			case "I": // Blank record, no action required
				break;
			case "C": // Copy an existing record
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("artistalist.php"); // No matching record, return to list
				}

				// Set up detail parameters
				$this->SetUpDetailParms();
				break;
			case "A": // Add new record
				$this->SendEmail = TRUE; // Send email on add success
				if ($this->AddRow($this->OldRecordset)) { // Add successful
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("AddSuccess")); // Set up success message
					if ($this->getCurrentDetailTable() <> "") // Master/detail add
						$sReturnUrl = $this->GetDetailUrl();
					else
						$sReturnUrl = $this->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "artistaview.php")
						$sReturnUrl = $this->GetViewUrl(); // View paging, return to view page with keyurl directly
					$this->Page_Terminate($sReturnUrl); // Clean up and return
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Add failed, restore form values

					// Set up detail parameters
					$this->SetUpDetailParms();
				}
		}

		// Render row based on row type
		$this->RowType = EW_ROWTYPE_ADD;  // Render add type

		// Render row
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
		$this->ArtistaFoto->Upload->Index = $objForm->Index;
		if ($this->ArtistaFoto->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->ArtistaFoto->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->ArtistaFoto->CurrentValue = $this->ArtistaFoto->Upload->FileName;
		$this->ArtistaCV->Upload->Index = $objForm->Index;
		if ($this->ArtistaCV->Upload->UploadFile()) {

			// No action required
		} else {
			echo $this->ArtistaCV->Upload->Message;
			$this->Page_Terminate();
			exit();
		}
		$this->ArtistaCV->CurrentValue = $this->ArtistaCV->Upload->FileName;
	}

	// Load default values
	function LoadDefaultValues() {
		$this->ArtistaRubro->CurrentValue = 0;
		$this->ArtistaSubRubro->CurrentValue = 0;
		$this->ArtistaNombre->CurrentValue = NULL;
		$this->ArtistaNombre->OldValue = $this->ArtistaNombre->CurrentValue;
		$this->ArtistaFoto->Upload->DbValue = NULL;
		$this->ArtistaFoto->OldValue = $this->ArtistaFoto->Upload->DbValue;
		$this->ArtistaFoto->CurrentValue = NULL; // Clear file related field
		$this->ArtistaBio->CurrentValue = NULL;
		$this->ArtistaBio->OldValue = $this->ArtistaBio->CurrentValue;
		$this->ArtistaCV->Upload->DbValue = NULL;
		$this->ArtistaCV->OldValue = $this->ArtistaCV->Upload->DbValue;
		$this->ArtistaCV->CurrentValue = NULL; // Clear file related field
		$this->ArtistaTel->CurrentValue = NULL;
		$this->ArtistaTel->OldValue = $this->ArtistaTel->CurrentValue;
		$this->ArtistaEmail->CurrentValue = NULL;
		$this->ArtistaEmail->OldValue = $this->ArtistaEmail->CurrentValue;
		$this->ArtistaFace->CurrentValue = NULL;
		$this->ArtistaFace->OldValue = $this->ArtistaFace->CurrentValue;
		$this->ArtistaWeb->CurrentValue = NULL;
		$this->ArtistaWeb->OldValue = $this->ArtistaWeb->CurrentValue;
		$this->ArtistaDireccion->CurrentValue = NULL;
		$this->ArtistaDireccion->OldValue = $this->ArtistaDireccion->CurrentValue;
		$this->ArtistaLocalidad->CurrentValue = NULL;
		$this->ArtistaLocalidad->OldValue = $this->ArtistaLocalidad->CurrentValue;
		$this->ArtistaProvincia->CurrentValue = NULL;
		$this->ArtistaProvincia->OldValue = $this->ArtistaProvincia->CurrentValue;
		$this->ArtistaPais->CurrentValue = NULL;
		$this->ArtistaPais->OldValue = $this->ArtistaPais->CurrentValue;
		$this->ArtistaActivo->CurrentValue = NULL;
		$this->ArtistaActivo->OldValue = $this->ArtistaActivo->CurrentValue;
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		$this->GetUploadFiles(); // Get upload files
		if (!$this->ArtistaRubro->FldIsDetailKey) {
			$this->ArtistaRubro->setFormValue($objForm->GetValue("x_ArtistaRubro"));
		}
		if (!$this->ArtistaSubRubro->FldIsDetailKey) {
			$this->ArtistaSubRubro->setFormValue($objForm->GetValue("x_ArtistaSubRubro"));
		}
		if (!$this->ArtistaNombre->FldIsDetailKey) {
			$this->ArtistaNombre->setFormValue($objForm->GetValue("x_ArtistaNombre"));
		}
		if (!$this->ArtistaBio->FldIsDetailKey) {
			$this->ArtistaBio->setFormValue($objForm->GetValue("x_ArtistaBio"));
		}
		if (!$this->ArtistaTel->FldIsDetailKey) {
			$this->ArtistaTel->setFormValue($objForm->GetValue("x_ArtistaTel"));
		}
		if (!$this->ArtistaEmail->FldIsDetailKey) {
			$this->ArtistaEmail->setFormValue($objForm->GetValue("x_ArtistaEmail"));
		}
		if (!$this->ArtistaFace->FldIsDetailKey) {
			$this->ArtistaFace->setFormValue($objForm->GetValue("x_ArtistaFace"));
		}
		if (!$this->ArtistaWeb->FldIsDetailKey) {
			$this->ArtistaWeb->setFormValue($objForm->GetValue("x_ArtistaWeb"));
		}
		if (!$this->ArtistaDireccion->FldIsDetailKey) {
			$this->ArtistaDireccion->setFormValue($objForm->GetValue("x_ArtistaDireccion"));
		}
		if (!$this->ArtistaLocalidad->FldIsDetailKey) {
			$this->ArtistaLocalidad->setFormValue($objForm->GetValue("x_ArtistaLocalidad"));
		}
		if (!$this->ArtistaProvincia->FldIsDetailKey) {
			$this->ArtistaProvincia->setFormValue($objForm->GetValue("x_ArtistaProvincia"));
		}
		if (!$this->ArtistaPais->FldIsDetailKey) {
			$this->ArtistaPais->setFormValue($objForm->GetValue("x_ArtistaPais"));
		}
		if (!$this->ArtistaActivo->FldIsDetailKey) {
			$this->ArtistaActivo->setFormValue($objForm->GetValue("x_ArtistaActivo"));
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadOldRecord();
		$this->ArtistaRubro->CurrentValue = $this->ArtistaRubro->FormValue;
		$this->ArtistaSubRubro->CurrentValue = $this->ArtistaSubRubro->FormValue;
		$this->ArtistaNombre->CurrentValue = $this->ArtistaNombre->FormValue;
		$this->ArtistaBio->CurrentValue = $this->ArtistaBio->FormValue;
		$this->ArtistaTel->CurrentValue = $this->ArtistaTel->FormValue;
		$this->ArtistaEmail->CurrentValue = $this->ArtistaEmail->FormValue;
		$this->ArtistaFace->CurrentValue = $this->ArtistaFace->FormValue;
		$this->ArtistaWeb->CurrentValue = $this->ArtistaWeb->FormValue;
		$this->ArtistaDireccion->CurrentValue = $this->ArtistaDireccion->FormValue;
		$this->ArtistaLocalidad->CurrentValue = $this->ArtistaLocalidad->FormValue;
		$this->ArtistaProvincia->CurrentValue = $this->ArtistaProvincia->FormValue;
		$this->ArtistaPais->CurrentValue = $this->ArtistaPais->FormValue;
		$this->ArtistaActivo->CurrentValue = $this->ArtistaActivo->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->ArtistaId->setDbValue($rs->fields('ArtistaId'));
		$this->ArtistaRubro->setDbValue($rs->fields('ArtistaRubro'));
		$this->ArtistaSubRubro->setDbValue($rs->fields('ArtistaSubRubro'));
		$this->ArtistaNombre->setDbValue($rs->fields('ArtistaNombre'));
		$this->ArtistaFoto->Upload->DbValue = $rs->fields('ArtistaFoto');
		$this->ArtistaFoto->CurrentValue = $this->ArtistaFoto->Upload->DbValue;
		$this->ArtistaBio->setDbValue($rs->fields('ArtistaBio'));
		$this->ArtistaCV->Upload->DbValue = $rs->fields('ArtistaCV');
		$this->ArtistaCV->CurrentValue = $this->ArtistaCV->Upload->DbValue;
		$this->ArtistaTel->setDbValue($rs->fields('ArtistaTel'));
		$this->ArtistaEmail->setDbValue($rs->fields('ArtistaEmail'));
		$this->ArtistaFace->setDbValue($rs->fields('ArtistaFace'));
		$this->ArtistaWeb->setDbValue($rs->fields('ArtistaWeb'));
		$this->ArtistaDireccion->setDbValue($rs->fields('ArtistaDireccion'));
		$this->ArtistaLocalidad->setDbValue($rs->fields('ArtistaLocalidad'));
		$this->ArtistaProvincia->setDbValue($rs->fields('ArtistaProvincia'));
		$this->ArtistaPais->setDbValue($rs->fields('ArtistaPais'));
		$this->ArtistaActivo->setDbValue($rs->fields('ArtistaActivo'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->ArtistaId->DbValue = $row['ArtistaId'];
		$this->ArtistaRubro->DbValue = $row['ArtistaRubro'];
		$this->ArtistaSubRubro->DbValue = $row['ArtistaSubRubro'];
		$this->ArtistaNombre->DbValue = $row['ArtistaNombre'];
		$this->ArtistaFoto->Upload->DbValue = $row['ArtistaFoto'];
		$this->ArtistaBio->DbValue = $row['ArtistaBio'];
		$this->ArtistaCV->Upload->DbValue = $row['ArtistaCV'];
		$this->ArtistaTel->DbValue = $row['ArtistaTel'];
		$this->ArtistaEmail->DbValue = $row['ArtistaEmail'];
		$this->ArtistaFace->DbValue = $row['ArtistaFace'];
		$this->ArtistaWeb->DbValue = $row['ArtistaWeb'];
		$this->ArtistaDireccion->DbValue = $row['ArtistaDireccion'];
		$this->ArtistaLocalidad->DbValue = $row['ArtistaLocalidad'];
		$this->ArtistaProvincia->DbValue = $row['ArtistaProvincia'];
		$this->ArtistaPais->DbValue = $row['ArtistaPais'];
		$this->ArtistaActivo->DbValue = $row['ArtistaActivo'];
	}

	// Load old record
	function LoadOldRecord() {

		// Load key values from Session
		$bValidKey = TRUE;
		if (strval($this->getKey("ArtistaId")) <> "")
			$this->ArtistaId->CurrentValue = $this->getKey("ArtistaId"); // ArtistaId
		else
			$bValidKey = FALSE;

		// Load old recordset
		if ($bValidKey) {
			$this->CurrentFilter = $this->KeyFilter();
			$sSql = $this->SQL();
			$this->OldRecordset = ew_LoadRecordset($sSql);
			$this->LoadRowValues($this->OldRecordset); // Load row values
		} else {
			$this->OldRecordset = NULL;
		}
		return $bValidKey;
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// ArtistaId
		// ArtistaRubro
		// ArtistaSubRubro
		// ArtistaNombre
		// ArtistaFoto
		// ArtistaBio
		// ArtistaCV
		// ArtistaTel
		// ArtistaEmail
		// ArtistaFace
		// ArtistaWeb
		// ArtistaDireccion
		// ArtistaLocalidad
		// ArtistaProvincia
		// ArtistaPais
		// ArtistaActivo

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// ArtistaId
			$this->ArtistaId->ViewValue = $this->ArtistaId->CurrentValue;
			$this->ArtistaId->ViewCustomAttributes = "";

			// ArtistaRubro
			if (strval($this->ArtistaRubro->CurrentValue) <> "") {
				$sFilterWrk = "`RubroId`" . ew_SearchString("=", $this->ArtistaRubro->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `RubroId`, `RubroNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `rubros`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ArtistaRubro, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->ArtistaRubro->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->ArtistaRubro->ViewValue = $this->ArtistaRubro->CurrentValue;
				}
			} else {
				$this->ArtistaRubro->ViewValue = NULL;
			}
			$this->ArtistaRubro->ViewCustomAttributes = "";

			// ArtistaSubRubro
			if (strval($this->ArtistaSubRubro->CurrentValue) <> "") {
				$sFilterWrk = "`SubRubroId`" . ew_SearchString("=", $this->ArtistaSubRubro->CurrentValue, EW_DATATYPE_NUMBER);
			$sSqlWrk = "SELECT `SubRubroId`, `SubRubroNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `subrubro`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ArtistaSubRubro, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `SubRubroNombre`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$this->ArtistaSubRubro->ViewValue = $rswrk->fields('DispFld');
					$rswrk->Close();
				} else {
					$this->ArtistaSubRubro->ViewValue = $this->ArtistaSubRubro->CurrentValue;
				}
			} else {
				$this->ArtistaSubRubro->ViewValue = NULL;
			}
			$this->ArtistaSubRubro->ViewCustomAttributes = "";

			// ArtistaNombre
			$this->ArtistaNombre->ViewValue = $this->ArtistaNombre->CurrentValue;
			$this->ArtistaNombre->ViewCustomAttributes = "";

			// ArtistaFoto
			if (!ew_Empty($this->ArtistaFoto->Upload->DbValue)) {
				$this->ArtistaFoto->ViewValue = $this->ArtistaFoto->Upload->DbValue;
			} else {
				$this->ArtistaFoto->ViewValue = "";
			}
			$this->ArtistaFoto->ViewCustomAttributes = "";

			// ArtistaBio
			$this->ArtistaBio->ViewValue = $this->ArtistaBio->CurrentValue;
			$this->ArtistaBio->ViewCustomAttributes = "";

			// ArtistaCV
			if (!ew_Empty($this->ArtistaCV->Upload->DbValue)) {
				$this->ArtistaCV->ViewValue = $this->ArtistaCV->Upload->DbValue;
			} else {
				$this->ArtistaCV->ViewValue = "";
			}
			$this->ArtistaCV->ViewCustomAttributes = "";

			// ArtistaTel
			$this->ArtistaTel->ViewValue = $this->ArtistaTel->CurrentValue;
			$this->ArtistaTel->ViewCustomAttributes = "";

			// ArtistaEmail
			$this->ArtistaEmail->ViewValue = $this->ArtistaEmail->CurrentValue;
			$this->ArtistaEmail->ViewCustomAttributes = "";

			// ArtistaFace
			$this->ArtistaFace->ViewValue = $this->ArtistaFace->CurrentValue;
			$this->ArtistaFace->ViewCustomAttributes = "";

			// ArtistaWeb
			$this->ArtistaWeb->ViewValue = $this->ArtistaWeb->CurrentValue;
			$this->ArtistaWeb->ViewCustomAttributes = "";

			// ArtistaDireccion
			$this->ArtistaDireccion->ViewValue = $this->ArtistaDireccion->CurrentValue;
			$this->ArtistaDireccion->ViewCustomAttributes = "";

			// ArtistaLocalidad
			$this->ArtistaLocalidad->ViewValue = $this->ArtistaLocalidad->CurrentValue;
			$this->ArtistaLocalidad->ViewCustomAttributes = "";

			// ArtistaProvincia
			$this->ArtistaProvincia->ViewValue = $this->ArtistaProvincia->CurrentValue;
			$this->ArtistaProvincia->ViewCustomAttributes = "";

			// ArtistaPais
			$this->ArtistaPais->ViewValue = $this->ArtistaPais->CurrentValue;
			$this->ArtistaPais->ViewCustomAttributes = "";

			// ArtistaActivo
			if (strval($this->ArtistaActivo->CurrentValue) <> "") {
				switch ($this->ArtistaActivo->CurrentValue) {
					case $this->ArtistaActivo->FldTagValue(1):
						$this->ArtistaActivo->ViewValue = $this->ArtistaActivo->FldTagCaption(1) <> "" ? $this->ArtistaActivo->FldTagCaption(1) : $this->ArtistaActivo->CurrentValue;
						break;
					default:
						$this->ArtistaActivo->ViewValue = $this->ArtistaActivo->CurrentValue;
				}
			} else {
				$this->ArtistaActivo->ViewValue = NULL;
			}
			$this->ArtistaActivo->ViewCustomAttributes = "";

			// ArtistaRubro
			$this->ArtistaRubro->LinkCustomAttributes = "";
			$this->ArtistaRubro->HrefValue = "";
			$this->ArtistaRubro->TooltipValue = "";

			// ArtistaSubRubro
			$this->ArtistaSubRubro->LinkCustomAttributes = "";
			$this->ArtistaSubRubro->HrefValue = "";
			$this->ArtistaSubRubro->TooltipValue = "";

			// ArtistaNombre
			$this->ArtistaNombre->LinkCustomAttributes = "";
			$this->ArtistaNombre->HrefValue = "";
			$this->ArtistaNombre->TooltipValue = "";

			// ArtistaFoto
			$this->ArtistaFoto->LinkCustomAttributes = "";
			$this->ArtistaFoto->HrefValue = "";
			$this->ArtistaFoto->HrefValue2 = $this->ArtistaFoto->UploadPath . $this->ArtistaFoto->Upload->DbValue;
			$this->ArtistaFoto->TooltipValue = "";

			// ArtistaBio
			$this->ArtistaBio->LinkCustomAttributes = "";
			$this->ArtistaBio->HrefValue = "";
			$this->ArtistaBio->TooltipValue = "";

			// ArtistaCV
			$this->ArtistaCV->LinkCustomAttributes = "";
			$this->ArtistaCV->HrefValue = "";
			$this->ArtistaCV->HrefValue2 = $this->ArtistaCV->UploadPath . $this->ArtistaCV->Upload->DbValue;
			$this->ArtistaCV->TooltipValue = "";

			// ArtistaTel
			$this->ArtistaTel->LinkCustomAttributes = "";
			$this->ArtistaTel->HrefValue = "";
			$this->ArtistaTel->TooltipValue = "";

			// ArtistaEmail
			$this->ArtistaEmail->LinkCustomAttributes = "";
			$this->ArtistaEmail->HrefValue = "";
			$this->ArtistaEmail->TooltipValue = "";

			// ArtistaFace
			$this->ArtistaFace->LinkCustomAttributes = "";
			$this->ArtistaFace->HrefValue = "";
			$this->ArtistaFace->TooltipValue = "";

			// ArtistaWeb
			$this->ArtistaWeb->LinkCustomAttributes = "";
			$this->ArtistaWeb->HrefValue = "";
			$this->ArtistaWeb->TooltipValue = "";

			// ArtistaDireccion
			$this->ArtistaDireccion->LinkCustomAttributes = "";
			$this->ArtistaDireccion->HrefValue = "";
			$this->ArtistaDireccion->TooltipValue = "";

			// ArtistaLocalidad
			$this->ArtistaLocalidad->LinkCustomAttributes = "";
			$this->ArtistaLocalidad->HrefValue = "";
			$this->ArtistaLocalidad->TooltipValue = "";

			// ArtistaProvincia
			$this->ArtistaProvincia->LinkCustomAttributes = "";
			$this->ArtistaProvincia->HrefValue = "";
			$this->ArtistaProvincia->TooltipValue = "";

			// ArtistaPais
			$this->ArtistaPais->LinkCustomAttributes = "";
			$this->ArtistaPais->HrefValue = "";
			$this->ArtistaPais->TooltipValue = "";

			// ArtistaActivo
			$this->ArtistaActivo->LinkCustomAttributes = "";
			$this->ArtistaActivo->HrefValue = "";
			$this->ArtistaActivo->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_ADD) { // Add row

			// ArtistaRubro
			$this->ArtistaRubro->EditCustomAttributes = "";
			$sFilterWrk = "";
			$sSqlWrk = "SELECT `RubroId`, `RubroNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `rubros`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ArtistaRubro, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->ArtistaRubro->EditValue = $arwrk;

			// ArtistaSubRubro
			$this->ArtistaSubRubro->EditCustomAttributes = "";
			$sFilterWrk = "";
			$sSqlWrk = "SELECT `SubRubroId`, `SubRubroNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, `SubRubro` AS `SelectFilterFld`, '' AS `SelectFilterFld2`, '' AS `SelectFilterFld3`, '' AS `SelectFilterFld4` FROM `subrubro`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				ew_AddFilter($sWhereWrk, $sFilterWrk);
			}

			// Call Lookup selecting
			$this->Lookup_Selecting($this->ArtistaSubRubro, $sWhereWrk);
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `SubRubroNombre`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", "", "", "", "", "", ""));
			$this->ArtistaSubRubro->EditValue = $arwrk;

			// ArtistaNombre
			$this->ArtistaNombre->EditCustomAttributes = "";
			$this->ArtistaNombre->EditValue = ew_HtmlEncode($this->ArtistaNombre->CurrentValue);
			$this->ArtistaNombre->PlaceHolder = ew_RemoveHtml($this->ArtistaNombre->FldCaption());

			// ArtistaFoto
			$this->ArtistaFoto->EditCustomAttributes = "";
			if (!ew_Empty($this->ArtistaFoto->Upload->DbValue)) {
				$this->ArtistaFoto->EditValue = $this->ArtistaFoto->Upload->DbValue;
			} else {
				$this->ArtistaFoto->EditValue = "";
			}
			if (!ew_Empty($this->ArtistaFoto->CurrentValue))
				$this->ArtistaFoto->Upload->FileName = $this->ArtistaFoto->CurrentValue;
			if (($this->CurrentAction == "I" || $this->CurrentAction == "C") && !$this->EventCancelled) ew_RenderUploadField($this->ArtistaFoto);

			// ArtistaBio
			$this->ArtistaBio->EditCustomAttributes = "";
			$this->ArtistaBio->EditValue = $this->ArtistaBio->CurrentValue;
			$this->ArtistaBio->PlaceHolder = ew_RemoveHtml($this->ArtistaBio->FldCaption());

			// ArtistaCV
			$this->ArtistaCV->EditCustomAttributes = "";
			if (!ew_Empty($this->ArtistaCV->Upload->DbValue)) {
				$this->ArtistaCV->EditValue = $this->ArtistaCV->Upload->DbValue;
			} else {
				$this->ArtistaCV->EditValue = "";
			}
			if (!ew_Empty($this->ArtistaCV->CurrentValue))
				$this->ArtistaCV->Upload->FileName = $this->ArtistaCV->CurrentValue;
			if (($this->CurrentAction == "I" || $this->CurrentAction == "C") && !$this->EventCancelled) ew_RenderUploadField($this->ArtistaCV);

			// ArtistaTel
			$this->ArtistaTel->EditCustomAttributes = "";
			$this->ArtistaTel->EditValue = ew_HtmlEncode($this->ArtistaTel->CurrentValue);
			$this->ArtistaTel->PlaceHolder = ew_RemoveHtml($this->ArtistaTel->FldCaption());

			// ArtistaEmail
			$this->ArtistaEmail->EditCustomAttributes = "";
			$this->ArtistaEmail->EditValue = ew_HtmlEncode($this->ArtistaEmail->CurrentValue);
			$this->ArtistaEmail->PlaceHolder = ew_RemoveHtml($this->ArtistaEmail->FldCaption());

			// ArtistaFace
			$this->ArtistaFace->EditCustomAttributes = "";
			$this->ArtistaFace->EditValue = ew_HtmlEncode($this->ArtistaFace->CurrentValue);
			$this->ArtistaFace->PlaceHolder = ew_RemoveHtml($this->ArtistaFace->FldCaption());

			// ArtistaWeb
			$this->ArtistaWeb->EditCustomAttributes = "";
			$this->ArtistaWeb->EditValue = ew_HtmlEncode($this->ArtistaWeb->CurrentValue);
			$this->ArtistaWeb->PlaceHolder = ew_RemoveHtml($this->ArtistaWeb->FldCaption());

			// ArtistaDireccion
			$this->ArtistaDireccion->EditCustomAttributes = "";
			$this->ArtistaDireccion->EditValue = ew_HtmlEncode($this->ArtistaDireccion->CurrentValue);
			$this->ArtistaDireccion->PlaceHolder = ew_RemoveHtml($this->ArtistaDireccion->FldCaption());

			// ArtistaLocalidad
			$this->ArtistaLocalidad->EditCustomAttributes = "";
			$this->ArtistaLocalidad->EditValue = ew_HtmlEncode($this->ArtistaLocalidad->CurrentValue);
			$this->ArtistaLocalidad->PlaceHolder = ew_RemoveHtml($this->ArtistaLocalidad->FldCaption());

			// ArtistaProvincia
			$this->ArtistaProvincia->EditCustomAttributes = "";
			$this->ArtistaProvincia->EditValue = ew_HtmlEncode($this->ArtistaProvincia->CurrentValue);
			$this->ArtistaProvincia->PlaceHolder = ew_RemoveHtml($this->ArtistaProvincia->FldCaption());

			// ArtistaPais
			$this->ArtistaPais->EditCustomAttributes = "";
			$this->ArtistaPais->EditValue = ew_HtmlEncode($this->ArtistaPais->CurrentValue);
			$this->ArtistaPais->PlaceHolder = ew_RemoveHtml($this->ArtistaPais->FldCaption());

			// ArtistaActivo
			$this->ArtistaActivo->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array($this->ArtistaActivo->FldTagValue(1), $this->ArtistaActivo->FldTagCaption(1) <> "" ? $this->ArtistaActivo->FldTagCaption(1) : $this->ArtistaActivo->FldTagValue(1));
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$this->ArtistaActivo->EditValue = $arwrk;

			// Edit refer script
			// ArtistaRubro

			$this->ArtistaRubro->HrefValue = "";

			// ArtistaSubRubro
			$this->ArtistaSubRubro->HrefValue = "";

			// ArtistaNombre
			$this->ArtistaNombre->HrefValue = "";

			// ArtistaFoto
			$this->ArtistaFoto->HrefValue = "";
			$this->ArtistaFoto->HrefValue2 = $this->ArtistaFoto->UploadPath . $this->ArtistaFoto->Upload->DbValue;

			// ArtistaBio
			$this->ArtistaBio->HrefValue = "";

			// ArtistaCV
			$this->ArtistaCV->HrefValue = "";
			$this->ArtistaCV->HrefValue2 = $this->ArtistaCV->UploadPath . $this->ArtistaCV->Upload->DbValue;

			// ArtistaTel
			$this->ArtistaTel->HrefValue = "";

			// ArtistaEmail
			$this->ArtistaEmail->HrefValue = "";

			// ArtistaFace
			$this->ArtistaFace->HrefValue = "";

			// ArtistaWeb
			$this->ArtistaWeb->HrefValue = "";

			// ArtistaDireccion
			$this->ArtistaDireccion->HrefValue = "";

			// ArtistaLocalidad
			$this->ArtistaLocalidad->HrefValue = "";

			// ArtistaProvincia
			$this->ArtistaProvincia->HrefValue = "";

			// ArtistaPais
			$this->ArtistaPais->HrefValue = "";

			// ArtistaActivo
			$this->ArtistaActivo->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!$this->ArtistaRubro->FldIsDetailKey && !is_null($this->ArtistaRubro->FormValue) && $this->ArtistaRubro->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->ArtistaRubro->FldCaption());
		}
		if (!$this->ArtistaSubRubro->FldIsDetailKey && !is_null($this->ArtistaSubRubro->FormValue) && $this->ArtistaSubRubro->FormValue == "") {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->ArtistaSubRubro->FldCaption());
		}
		if (is_null($this->ArtistaFoto->Upload->Value) && !$this->ArtistaFoto->Upload->KeepFile) {
			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $this->ArtistaFoto->FldCaption());
		}

		// Validate detail grid
		$DetailTblVar = explode(",", $this->getCurrentDetailTable());
		if (in_array("obras", $DetailTblVar) && $GLOBALS["obras"]->DetailAdd) {
			if (!isset($GLOBALS["obras_grid"])) $GLOBALS["obras_grid"] = new cobras_grid(); // get detail page object
			$GLOBALS["obras_grid"]->ValidateGridForm();
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Add record
	function AddRow($rsold = NULL) {
		global $conn, $Language, $Security;

		// Begin transaction
		if ($this->getCurrentDetailTable() <> "")
			$conn->BeginTrans();

		// Load db values from rsold
		if ($rsold) {
			$this->LoadDbValues($rsold);
		}
		$rsnew = array();

		// ArtistaRubro
		$this->ArtistaRubro->SetDbValueDef($rsnew, $this->ArtistaRubro->CurrentValue, 0, strval($this->ArtistaRubro->CurrentValue) == "");

		// ArtistaSubRubro
		$this->ArtistaSubRubro->SetDbValueDef($rsnew, $this->ArtistaSubRubro->CurrentValue, 0, strval($this->ArtistaSubRubro->CurrentValue) == "");

		// ArtistaNombre
		$this->ArtistaNombre->SetDbValueDef($rsnew, $this->ArtistaNombre->CurrentValue, NULL, FALSE);

		// ArtistaFoto
		if (!(strval($this->ArtistaFoto->CurrentValue) == "") && !$this->ArtistaFoto->Upload->KeepFile) {
			if ($this->ArtistaFoto->Upload->FileName == "") {
				$rsnew['ArtistaFoto'] = NULL;
			} else {
				$rsnew['ArtistaFoto'] = $this->ArtistaFoto->Upload->FileName;
			}
		}

		// ArtistaBio
		$this->ArtistaBio->SetDbValueDef($rsnew, $this->ArtistaBio->CurrentValue, NULL, FALSE);

		// ArtistaCV
		if (!$this->ArtistaCV->Upload->KeepFile) {
			if ($this->ArtistaCV->Upload->FileName == "") {
				$rsnew['ArtistaCV'] = NULL;
			} else {
				$rsnew['ArtistaCV'] = $this->ArtistaCV->Upload->FileName;
			}
		}

		// ArtistaTel
		$this->ArtistaTel->SetDbValueDef($rsnew, $this->ArtistaTel->CurrentValue, NULL, FALSE);

		// ArtistaEmail
		$this->ArtistaEmail->SetDbValueDef($rsnew, $this->ArtistaEmail->CurrentValue, NULL, FALSE);

		// ArtistaFace
		$this->ArtistaFace->SetDbValueDef($rsnew, $this->ArtistaFace->CurrentValue, NULL, FALSE);

		// ArtistaWeb
		$this->ArtistaWeb->SetDbValueDef($rsnew, $this->ArtistaWeb->CurrentValue, NULL, FALSE);

		// ArtistaDireccion
		$this->ArtistaDireccion->SetDbValueDef($rsnew, $this->ArtistaDireccion->CurrentValue, NULL, FALSE);

		// ArtistaLocalidad
		$this->ArtistaLocalidad->SetDbValueDef($rsnew, $this->ArtistaLocalidad->CurrentValue, NULL, FALSE);

		// ArtistaProvincia
		$this->ArtistaProvincia->SetDbValueDef($rsnew, $this->ArtistaProvincia->CurrentValue, NULL, FALSE);

		// ArtistaPais
		$this->ArtistaPais->SetDbValueDef($rsnew, $this->ArtistaPais->CurrentValue, NULL, FALSE);

		// ArtistaActivo
		$this->ArtistaActivo->SetDbValueDef($rsnew, $this->ArtistaActivo->CurrentValue, NULL, FALSE);
		if (!$this->ArtistaFoto->Upload->KeepFile) {
			if (!ew_Empty($this->ArtistaFoto->Upload->Value)) {
				$rsnew['ArtistaFoto'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->ArtistaFoto->UploadPath), $rsnew['ArtistaFoto']); // Get new file name
			}
		}
		if (!$this->ArtistaCV->Upload->KeepFile) {
			if (!ew_Empty($this->ArtistaCV->Upload->Value)) {
				$rsnew['ArtistaCV'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->ArtistaCV->UploadPath), $rsnew['ArtistaCV']); // Get new file name
			}
		}

		// Call Row Inserting event
		$rs = ($rsold == NULL) ? NULL : $rsold->fields;
		$bInsertRow = $this->Row_Inserting($rs, $rsnew);
		if ($bInsertRow) {
			$conn->raiseErrorFn = 'ew_ErrorFn';
			$AddRow = $this->Insert($rsnew);
			$conn->raiseErrorFn = '';
			if ($AddRow) {
				if (!$this->ArtistaFoto->Upload->KeepFile) {
					if (!ew_Empty($this->ArtistaFoto->Upload->Value)) {
						$this->ArtistaFoto->Upload->SaveToFile($this->ArtistaFoto->UploadPath, $rsnew['ArtistaFoto'], TRUE);
					}
				}
				if (!$this->ArtistaCV->Upload->KeepFile) {
					if (!ew_Empty($this->ArtistaCV->Upload->Value)) {
						$this->ArtistaCV->Upload->SaveToFile($this->ArtistaCV->UploadPath, $rsnew['ArtistaCV'], TRUE);
					}
				}
			}
		} else {
			if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

				// Use the message, do nothing
			} elseif ($this->CancelMessage <> "") {
				$this->setFailureMessage($this->CancelMessage);
				$this->CancelMessage = "";
			} else {
				$this->setFailureMessage($Language->Phrase("InsertCancelled"));
			}
			$AddRow = FALSE;
		}

		// Get insert id if necessary
		if ($AddRow) {
			$this->ArtistaId->setDbValue($conn->Insert_ID());
			$rsnew['ArtistaId'] = $this->ArtistaId->DbValue;
		}

		// Add detail records
		if ($AddRow) {
			$DetailTblVar = explode(",", $this->getCurrentDetailTable());
			if (in_array("obras", $DetailTblVar) && $GLOBALS["obras"]->DetailAdd) {
				$GLOBALS["obras"]->ObraArtista->setSessionValue($this->ArtistaId->CurrentValue); // Set master key
				if (!isset($GLOBALS["obras_grid"])) $GLOBALS["obras_grid"] = new cobras_grid(); // Get detail page object
				$AddRow = $GLOBALS["obras_grid"]->GridInsert();
				if (!$AddRow)
					$GLOBALS["obras"]->ObraArtista->setSessionValue(""); // Clear master key if insert failed
			}
		}

		// Commit/Rollback transaction
		if ($this->getCurrentDetailTable() <> "") {
			if ($AddRow) {
				$conn->CommitTrans(); // Commit transaction
			} else {
				$conn->RollbackTrans(); // Rollback transaction
			}
		}
		if ($AddRow) {

			// Call Row Inserted event
			$rs = ($rsold == NULL) ? NULL : $rsold->fields;
			$this->Row_Inserted($rs, $rsnew);
		}

		// ArtistaFoto
		ew_CleanUploadTempPath($this->ArtistaFoto, $this->ArtistaFoto->Upload->Index);

		// ArtistaCV
		ew_CleanUploadTempPath($this->ArtistaCV, $this->ArtistaCV->Upload->Index);
		return $AddRow;
	}

	// Set up detail parms based on QueryString
	function SetUpDetailParms() {

		// Get the keys for master table
		if (isset($_GET[EW_TABLE_SHOW_DETAIL])) {
			$sDetailTblVar = $_GET[EW_TABLE_SHOW_DETAIL];
			$this->setCurrentDetailTable($sDetailTblVar);
		} else {
			$sDetailTblVar = $this->getCurrentDetailTable();
		}
		if ($sDetailTblVar <> "") {
			$DetailTblVar = explode(",", $sDetailTblVar);
			if (in_array("obras", $DetailTblVar)) {
				if (!isset($GLOBALS["obras_grid"]))
					$GLOBALS["obras_grid"] = new cobras_grid;
				if ($GLOBALS["obras_grid"]->DetailAdd) {
					if ($this->CopyRecord)
						$GLOBALS["obras_grid"]->CurrentMode = "copy";
					else
						$GLOBALS["obras_grid"]->CurrentMode = "add";
					$GLOBALS["obras_grid"]->CurrentAction = "gridadd";

					// Save current master table to detail table
					$GLOBALS["obras_grid"]->setCurrentMasterTable($this->TableVar);
					$GLOBALS["obras_grid"]->setStartRecordNumber(1);
					$GLOBALS["obras_grid"]->ObraArtista->FldIsDetailKey = TRUE;
					$GLOBALS["obras_grid"]->ObraArtista->CurrentValue = $this->ArtistaId->CurrentValue;
					$GLOBALS["obras_grid"]->ObraArtista->setSessionValue($GLOBALS["obras_grid"]->ObraArtista->CurrentValue);
				}
			}
		}
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "artistalist.php", $this->TableVar, TRUE);
		$PageId = ($this->CurrentAction == "C") ? "Copy" : "Add";
		$Breadcrumb->Add("add", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($artista_add)) $artista_add = new cartista_add();

// Page init
$artista_add->Page_Init();

// Page main
$artista_add->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$artista_add->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var artista_add = new ew_Page("artista_add");
artista_add.PageID = "add"; // Page ID
var EW_PAGE_ID = artista_add.PageID; // For backward compatibility

// Form object
var fartistaadd = new ew_Form("fartistaadd");

// Validate form
fartistaadd.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_ArtistaRubro");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($artista->ArtistaRubro->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_ArtistaSubRubro");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($artista->ArtistaSubRubro->FldCaption()) ?>");
			felm = this.GetElements("x" + infix + "_ArtistaFoto");
			elm = this.GetElements("fn_x" + infix + "_ArtistaFoto");
			if (felm && elm && !ew_HasValue(elm))
				return this.OnError(felm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($artista->ArtistaFoto->FldCaption()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fartistaadd.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fartistaadd.ValidateRequired = true;
<?php } else { ?>
fartistaadd.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fartistaadd.Lists["x_ArtistaRubro"] = {"LinkField":"x_RubroId","Ajax":null,"AutoFill":false,"DisplayFields":["x_RubroNombre","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};
fartistaadd.Lists["x_ArtistaSubRubro"] = {"LinkField":"x_SubRubroId","Ajax":null,"AutoFill":false,"DisplayFields":["x_SubRubroNombre","","",""],"ParentFields":["x_ArtistaRubro"],"FilterFields":["x_SubRubro"],"Options":[]};

// Form object for search
</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $artista_add->ShowPageHeader(); ?>
<?php
$artista_add->ShowMessage();
?>
<form name="fartistaadd" id="fartistaadd" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="artista">
<input type="hidden" name="a_add" id="a_add" value="A">
<table class="ewGrid"><tr><td>
<table id="tbl_artistaadd" class="table table-bordered table-striped">
<?php if ($artista->ArtistaRubro->Visible) { // ArtistaRubro ?>
	<tr id="r_ArtistaRubro">
		<td><span id="elh_artista_ArtistaRubro"><?php echo $artista->ArtistaRubro->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $artista->ArtistaRubro->CellAttributes() ?>>
<span id="el_artista_ArtistaRubro" class="control-group">
<?php $artista->ArtistaRubro->EditAttrs["onchange"] = "ew_UpdateOpt.call(this, ['x_ArtistaSubRubro']); " . @$artista->ArtistaRubro->EditAttrs["onchange"]; ?>
<select data-field="x_ArtistaRubro" id="x_ArtistaRubro" name="x_ArtistaRubro"<?php echo $artista->ArtistaRubro->EditAttributes() ?>>
<?php
if (is_array($artista->ArtistaRubro->EditValue)) {
	$arwrk = $artista->ArtistaRubro->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($artista->ArtistaRubro->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<script type="text/javascript">
fartistaadd.Lists["x_ArtistaRubro"].Options = <?php echo (is_array($artista->ArtistaRubro->EditValue)) ? ew_ArrayToJson($artista->ArtistaRubro->EditValue, 1) : "[]" ?>;
</script>
</span>
<?php echo $artista->ArtistaRubro->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaSubRubro->Visible) { // ArtistaSubRubro ?>
	<tr id="r_ArtistaSubRubro">
		<td><span id="elh_artista_ArtistaSubRubro"><?php echo $artista->ArtistaSubRubro->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $artista->ArtistaSubRubro->CellAttributes() ?>>
<span id="el_artista_ArtistaSubRubro" class="control-group">
<select data-field="x_ArtistaSubRubro" id="x_ArtistaSubRubro" name="x_ArtistaSubRubro"<?php echo $artista->ArtistaSubRubro->EditAttributes() ?>>
<?php
if (is_array($artista->ArtistaSubRubro->EditValue)) {
	$arwrk = $artista->ArtistaSubRubro->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($artista->ArtistaSubRubro->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<script type="text/javascript">
fartistaadd.Lists["x_ArtistaSubRubro"].Options = <?php echo (is_array($artista->ArtistaSubRubro->EditValue)) ? ew_ArrayToJson($artista->ArtistaSubRubro->EditValue, 1) : "[]" ?>;
</script>
</span>
<?php echo $artista->ArtistaSubRubro->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaNombre->Visible) { // ArtistaNombre ?>
	<tr id="r_ArtistaNombre">
		<td><span id="elh_artista_ArtistaNombre"><?php echo $artista->ArtistaNombre->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaNombre->CellAttributes() ?>>
<span id="el_artista_ArtistaNombre" class="control-group">
<input type="text" data-field="x_ArtistaNombre" name="x_ArtistaNombre" id="x_ArtistaNombre" size="30" maxlength="100" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaNombre->PlaceHolder) ?>" value="<?php echo $artista->ArtistaNombre->EditValue ?>"<?php echo $artista->ArtistaNombre->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaNombre->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaFoto->Visible) { // ArtistaFoto ?>
	<tr id="r_ArtistaFoto">
		<td><span id="elh_artista_ArtistaFoto"><?php echo $artista->ArtistaFoto->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></span></td>
		<td<?php echo $artista->ArtistaFoto->CellAttributes() ?>>
<span id="el_artista_ArtistaFoto" class="control-group">
<span id="fd_x_ArtistaFoto">
<span class="btn btn-small fileinput-button"<?php if ($artista->ArtistaFoto->ReadOnly || $artista->ArtistaFoto->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_ArtistaFoto" name="x_ArtistaFoto" id="x_ArtistaFoto">
</span>
<input type="hidden" name="fn_x_ArtistaFoto" id= "fn_x_ArtistaFoto" value="<?php echo $artista->ArtistaFoto->Upload->FileName ?>">
<input type="hidden" name="fa_x_ArtistaFoto" id= "fa_x_ArtistaFoto" value="0">
<input type="hidden" name="fs_x_ArtistaFoto" id= "fs_x_ArtistaFoto" value="50">
</span>
<table id="ft_x_ArtistaFoto" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $artista->ArtistaFoto->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaBio->Visible) { // ArtistaBio ?>
	<tr id="r_ArtistaBio">
		<td><span id="elh_artista_ArtistaBio"><?php echo $artista->ArtistaBio->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaBio->CellAttributes() ?>>
<span id="el_artista_ArtistaBio" class="control-group">
<textarea data-field="x_ArtistaBio" class="editor" name="x_ArtistaBio" id="x_ArtistaBio" cols="45" rows="7" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaBio->PlaceHolder) ?>"<?php echo $artista->ArtistaBio->EditAttributes() ?>><?php echo $artista->ArtistaBio->EditValue ?></textarea>
<script type="text/javascript">
ew_CreateEditor("fartistaadd", "x_ArtistaBio", 45, 7, <?php echo ($artista->ArtistaBio->ReadOnly || FALSE) ? "true" : "false" ?>);
</script>
</span>
<?php echo $artista->ArtistaBio->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaCV->Visible) { // ArtistaCV ?>
	<tr id="r_ArtistaCV">
		<td><span id="elh_artista_ArtistaCV"><?php echo $artista->ArtistaCV->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaCV->CellAttributes() ?>>
<span id="el_artista_ArtistaCV" class="control-group">
<span id="fd_x_ArtistaCV">
<span class="btn btn-small fileinput-button"<?php if ($artista->ArtistaCV->ReadOnly || $artista->ArtistaCV->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_ArtistaCV" name="x_ArtistaCV" id="x_ArtistaCV">
</span>
<input type="hidden" name="fn_x_ArtistaCV" id= "fn_x_ArtistaCV" value="<?php echo $artista->ArtistaCV->Upload->FileName ?>">
<input type="hidden" name="fa_x_ArtistaCV" id= "fa_x_ArtistaCV" value="0">
<input type="hidden" name="fs_x_ArtistaCV" id= "fs_x_ArtistaCV" value="80">
</span>
<table id="ft_x_ArtistaCV" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</span>
<?php echo $artista->ArtistaCV->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaTel->Visible) { // ArtistaTel ?>
	<tr id="r_ArtistaTel">
		<td><span id="elh_artista_ArtistaTel"><?php echo $artista->ArtistaTel->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaTel->CellAttributes() ?>>
<span id="el_artista_ArtistaTel" class="control-group">
<input type="text" data-field="x_ArtistaTel" name="x_ArtistaTel" id="x_ArtistaTel" size="30" maxlength="20" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaTel->PlaceHolder) ?>" value="<?php echo $artista->ArtistaTel->EditValue ?>"<?php echo $artista->ArtistaTel->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaTel->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaEmail->Visible) { // ArtistaEmail ?>
	<tr id="r_ArtistaEmail">
		<td><span id="elh_artista_ArtistaEmail"><?php echo $artista->ArtistaEmail->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaEmail->CellAttributes() ?>>
<span id="el_artista_ArtistaEmail" class="control-group">
<input type="text" data-field="x_ArtistaEmail" name="x_ArtistaEmail" id="x_ArtistaEmail" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaEmail->PlaceHolder) ?>" value="<?php echo $artista->ArtistaEmail->EditValue ?>"<?php echo $artista->ArtistaEmail->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaEmail->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaFace->Visible) { // ArtistaFace ?>
	<tr id="r_ArtistaFace">
		<td><span id="elh_artista_ArtistaFace"><?php echo $artista->ArtistaFace->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaFace->CellAttributes() ?>>
<span id="el_artista_ArtistaFace" class="control-group">
<input type="text" data-field="x_ArtistaFace" name="x_ArtistaFace" id="x_ArtistaFace" size="30" maxlength="80" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaFace->PlaceHolder) ?>" value="<?php echo $artista->ArtistaFace->EditValue ?>"<?php echo $artista->ArtistaFace->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaFace->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaWeb->Visible) { // ArtistaWeb ?>
	<tr id="r_ArtistaWeb">
		<td><span id="elh_artista_ArtistaWeb"><?php echo $artista->ArtistaWeb->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaWeb->CellAttributes() ?>>
<span id="el_artista_ArtistaWeb" class="control-group">
<input type="text" data-field="x_ArtistaWeb" name="x_ArtistaWeb" id="x_ArtistaWeb" size="30" maxlength="80" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaWeb->PlaceHolder) ?>" value="<?php echo $artista->ArtistaWeb->EditValue ?>"<?php echo $artista->ArtistaWeb->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaWeb->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaDireccion->Visible) { // ArtistaDireccion ?>
	<tr id="r_ArtistaDireccion">
		<td><span id="elh_artista_ArtistaDireccion"><?php echo $artista->ArtistaDireccion->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaDireccion->CellAttributes() ?>>
<span id="el_artista_ArtistaDireccion" class="control-group">
<input type="text" data-field="x_ArtistaDireccion" name="x_ArtistaDireccion" id="x_ArtistaDireccion" size="30" maxlength="70" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaDireccion->PlaceHolder) ?>" value="<?php echo $artista->ArtistaDireccion->EditValue ?>"<?php echo $artista->ArtistaDireccion->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaDireccion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaLocalidad->Visible) { // ArtistaLocalidad ?>
	<tr id="r_ArtistaLocalidad">
		<td><span id="elh_artista_ArtistaLocalidad"><?php echo $artista->ArtistaLocalidad->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaLocalidad->CellAttributes() ?>>
<span id="el_artista_ArtistaLocalidad" class="control-group">
<input type="text" data-field="x_ArtistaLocalidad" name="x_ArtistaLocalidad" id="x_ArtistaLocalidad" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaLocalidad->PlaceHolder) ?>" value="<?php echo $artista->ArtistaLocalidad->EditValue ?>"<?php echo $artista->ArtistaLocalidad->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaLocalidad->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaProvincia->Visible) { // ArtistaProvincia ?>
	<tr id="r_ArtistaProvincia">
		<td><span id="elh_artista_ArtistaProvincia"><?php echo $artista->ArtistaProvincia->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaProvincia->CellAttributes() ?>>
<span id="el_artista_ArtistaProvincia" class="control-group">
<input type="text" data-field="x_ArtistaProvincia" name="x_ArtistaProvincia" id="x_ArtistaProvincia" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaProvincia->PlaceHolder) ?>" value="<?php echo $artista->ArtistaProvincia->EditValue ?>"<?php echo $artista->ArtistaProvincia->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaProvincia->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaPais->Visible) { // ArtistaPais ?>
	<tr id="r_ArtistaPais">
		<td><span id="elh_artista_ArtistaPais"><?php echo $artista->ArtistaPais->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaPais->CellAttributes() ?>>
<span id="el_artista_ArtistaPais" class="control-group">
<input type="text" data-field="x_ArtistaPais" name="x_ArtistaPais" id="x_ArtistaPais" size="30" maxlength="50" placeholder="<?php echo ew_HtmlEncode($artista->ArtistaPais->PlaceHolder) ?>" value="<?php echo $artista->ArtistaPais->EditValue ?>"<?php echo $artista->ArtistaPais->EditAttributes() ?>>
</span>
<?php echo $artista->ArtistaPais->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($artista->ArtistaActivo->Visible) { // ArtistaActivo ?>
	<tr id="r_ArtistaActivo">
		<td><span id="elh_artista_ArtistaActivo"><?php echo $artista->ArtistaActivo->FldCaption() ?></span></td>
		<td<?php echo $artista->ArtistaActivo->CellAttributes() ?>>
<span id="el_artista_ArtistaActivo" class="control-group">
<select data-field="x_ArtistaActivo" id="x_ArtistaActivo" name="x_ArtistaActivo"<?php echo $artista->ArtistaActivo->EditAttributes() ?>>
<?php
if (is_array($artista->ArtistaActivo->EditValue)) {
	$arwrk = $artista->ArtistaActivo->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($artista->ArtistaActivo->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
<?php echo $artista->ArtistaActivo->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<?php
	if (in_array("obras", explode(",", $artista->getCurrentDetailTable())) && $obras->DetailAdd) {
?>
<?php include_once "obrasgrid.php" ?>
<?php } ?>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("AddBtn") ?></button>
</form>
<script type="text/javascript">
fartistaadd.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$artista_add->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$artista_add->Page_Terminate();
?>
